<!DOCTYPE html>
<html lang="en">
<head>
	<title>Instagram Ad Partner Search | GugeeData</title>
	<meta name="viewport"
	      content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
	<meta name="description" content="Quickly find high-quality Instagram influencers to collaborate based on their advertising performance | GugeeData">
	<meta name="keywords" content="Instagram commercial, Instagram User Search">
	<meta property="og:title" content="Instagram Ad Partner Search | GugeeData">
	<meta property="og:description" content="Quickly find high-quality Instagram influencers to collaborate based on their advertising performance | GugeeData">
	<meta property="og:type" content="website">
	<meta property="og:url" content="https://www.gugeedata.com/instagram/ad-partner-search">
	<meta property="og:image" content=" https://seo-imags.s3.us-east-2.amazonaws.com/Logo.png">
	<meta name="twitter:title" content="Instagram Ad Partner Search | GugeeDat">
	<meta name="twitter:description" content="Quickly find high-quality Instagram influencers to collaborate based on their advertising performance | GugeeData">

	<link rel="icon" href="/static/img/favicon.ico" type="image/x-icon"/>
	<link rel="shortcut icon" href="/static/img/favicon.ico" type="image/x-icon"/>

	<link rel="stylesheet" href="/static/css/ins/common.css">
    <#if isMobile == false>
		<link rel="stylesheet" href="/static/plugins/layui/layui.css">
		<link rel="stylesheet" href="/static/css/ins/search.css">
    <#else>
		<link rel="stylesheet" href="/static/css/ins/mobile/search.css">
    </#if>
	<link rel="stylesheet" href="/static/css/ins/media.css">
    <#include "../../../component/facebookPixel.ftl">
</head>
<body>
<#include "../../../header_new1.ftl">
<main>
    <#if isMobile == false>
		<section class="search-bg" id="userSearch">
			<div class="container">
				<h1>Instagram Ad Partner Search</h1>
				<h2>Quickly find high-quality Instagram influencers to collaborate based on their advertising performance .</h2>
                <#include "../../component/search/commonFilter.ftl">
			</div>
		</section>
        <#include "../../component/search/commonWrap.ftl">
    <#else>
	    <section>
		    <div class="container">
			    <h1>Instagram Ad Partner Search</h1>
			    <h2>Quickly find high-quality Instagram influencers to collaborate based on their advertising performance .</h2>
		    </div>
	    </section>
        <#include "../../component/search/commonWrapMobile.ftl">
    </#if>
</main>
<script src="${request.contextPath}/static/js/dayjs.min.js"></script>
<script src="${request.contextPath}/static/js/time.js"></script>
<script src="/static/plugins/echarts.min.js"></script>
<script>
	const inputPlaceholder = 'Please enter influencer username'
	const initParams = {
        page: 1,
        pageSize: 10,
        sort: 5
    }
    let params = Object.assign({}, initParams)
    const tableHeader = [
        {
            label: 'Influencer',
	        align: 'left'
        },
        {
            label: 'Ad Post',
            hasSort: true,
            sortIndex: 6,
            hasTip: true,
            tipContent: 'Number of posts that the influencer tagged business account in the last 30 days.'
        },
        {
            label: 'Avg Ad ER',
            hasSort: true,
            sortIndex: 4,
            hasTip: true,
            tipContent: 'The average engagement rate of ad posts in the last 30 days.'
        },
        {
            label: 'Ad Engagements',
            isActive: true,
            hasSort: true,
            sortIndex: 5,
            hasTip: true,
            tipContent: 'The total number of comments and likes on ad posts in the last 30 days.'
        },
        /*{
            label: 'Audience',
            align: 'left',
        },*/
        {
            label: 'Action'
        }
    ]
	const filterList = [
		{
            isInline: true,
            label: 'Account Categories',
            items: [
				{
                    selectDefaultLabel: 'Primary',
                    key: 'primaryCategory',
                    requestOption: true,
                    optionUrl: '/ins/dic/overall/category',
					type: 2
				},
                {
                    selectDefaultLabel: 'Secondary',
	                key: 'secondCategory',
                    type: 2
                }
			]
		},
		{
			isInline: true,
            label: 'Influencer Info',
            items: [
				{
                    selectDefaultLabel: 'Country/Region',
                    key: 'region',
                    requestOption: true,
                    optionUrl: '/ins/dic/region',
					requestParams: {
                      type: 1
					},
                    type: 2,
				},
                {
                    selectDefaultLabel: 'Language',
                    key: 'language',
	                requestOption: true,
	                optionUrl: '/ins/dic/language',
                    requestParams: {
                        type: 1
                    },
                    type: 2,
                },
				{
                    selectDefaultLabel: 'Gender',
                    key: 'gender',
                    type: 2,
					options: [
						{
						    label: 'All',
						},
						{
						    label: 'Male',
							value: 1
						},
						{
						    label: 'Female',
							value: 2
						},
						{
                            label: 'Undefined',
                            value: 3
						}
					]
				},
                {
                    selectDefaultLabel: 'Age',
                    key: 'age',
                    type: 2,
                    options: [
                        {
                            label: 'All',
                        },
                        {
                            label: '18-',
                            value: 1
                        },
                        {
                            label: '18 - 24',
                            value: 2
                        },
                        // {
                        //     label: '21+',
                        //     value: 3
                        // },
                        {
                            label: '25 - 34',
                            value: 4
                        },
                        {
                            label: '35 - 44',
                            value: 5
                        },
                        {
                            label: '45+',
                            value: 6
                        }
                    ]
                },
                {
                    selectDefaultLabel: 'Verification',
                    key: 'verification',
                    type: 2,
                    options: [
                        {
                            label: 'All',
                        },
                        {
                            label: 'Verified',
                            value: 1
                        },
                        {
                            label: 'Not verified',
                            value: 2
                        },
                    ]
                },
                {
                    selectDefaultLabel: 'Contact Info',
                    key: 'contact',
                    type: 2,
                    options: [
                        {
                            label: 'All',
                        },
                        {
                            label: 'Has Contact',
                            value: 1
                        },
                    ]
                },
                {
                    innerlabel: 'Tagged',
					label: 'Tagged',
                    placeHolder: 'Enter Tagged Account Username',
                    key: 'taggedUsername',
                    type: 1,
                },
			]
		},
		{
            isInline: true,
            label: 'Influencer Data',
            items: [
                {
                    selectDefaultLabel: 'Followers',
                    key: 'followers',
                    type: 2,
                    options: [
                        {
                            label: 'All',
                        },
                        {
                            label: '10K - 50K',
                            value: 1
                        },
                        {
                            label: '50K - 100K',
                            value: 2
                        },
                        {
                            label: '100K - 500K',
                            value: 3
                        },
                        {
                            label: '500K - 1M',
                            value: 4
                        },
                        {
                            label: '1M - 5M',
                            value: 5
                        },
                        {
                            label: '5M - 10M',
                            value: 6
                        },
                        {
                            label: '> 10M',
                            value: 7
                        },
                    ]
                },
                {
                    selectDefaultLabel: 'Avg Ad ER',
                    key: 'adEr',
                    type: 2,
                    options: [
                        {
                            label: 'All',
                        },
                        {
                            label: '1% - 3%',
                            value: 1
                        },
                        {
                            label: '3% - 5%',
                            value: 2
                        },
                        {
                            label: '5% - 10%',
                            value: 3
                        },
                        {
                            label: '10% - 20%',
                            value: 4
                        },{
                            label: '20% - 30%',
                            value: 5
                        },
                        {
                            label: '> 30%',
                            value: 6
                        },
                    ]
                },
			]
		},
        {
            label: 'Audience Data',
            isInline: true,
            items: [
                {
                    selectDefaultLabel: 'Location',
                    key: 'audienceRegionMore',
                    type: 2
                },
                {
                    selectDefaultLabel: 'Language',
                    key: 'audienceLanguageMore',
                    type: 2
                },
                {
                    selectDefaultLabel: 'Gender',
                    key: 'audienceGenderMore',
                    type: 2,
                    options: [
                        {
                            label: 'All',
                        },
                        {
                            label: 'More Male',
                            value: 1
                        },
                        {
                            label: 'More Female',
                            value: 2
                        },
                    ]
                },
                {
                    selectDefaultLabel: 'Age',
                    key: 'audienceAgeMore',
                    type: 2,
                    options: [
                        {
                            label: 'All',
                        },
                        {
                            label: '18-',
                            value: 1
                        },
                        {
                            label: '18 - 24',
                            value: 2
                        },
                        // {
                        //     label: '21+',
                        //     value: 3
                        // },
                        {
                            label: '25 - 34',
                            value: 4
                        },
                        {
                            label: '35 - 44',
                            value: 5
                        },
                        {
                            label: '45+',
                            value: 6
                        },
                    ]
                },
            ]
        },
	]
	const mobileSearchTab = [
		{
		    label: 'Ad Engagements',
			align: 'left',
			icon: 'icondown1',
			type: 1,
			options: [
				{
					label: 'Ad Post',
					value: 6
				},
                {
                    label: 'Avg Ad ER',
                    value: 4,
                },
                {
                    label: 'Ad Engagements',
                    value: 5,
                    isActive: true,
                },
			]
		},
        {
            label: 'Tip',
            align: 'right',
            icon: 'iconfaq',
            hasTip: true,
            tipContent: '<dl class=\'modal-tip\'>' +
                '<dt>1.Ad Post</dt>' +
                '<dd>Number of posts that the influencer tagged business account in the last 30 days.</dd>' +
                '<dt>2.Avg Ad ER</dt>' +
                '<dd>The average engagement rate of ad posts in the last 30 days.</dd>' +
                '<dt>3. Ad Engagements</dt>' +
                '<dd>The total number of comments and likes on ad posts in the last 30 days.</dd>' +
                '</dl>'
        },
        {
            label: 'Filter',
            align: 'right',
            icon: 'iconfilter-list',
	        isFilter: true,
	        roleId: 2,
        }
	]
</script>
<#include "../../component/search/commonScript.ftl">
<#if isMobile == true>
	<script src="${request.contextPath}/static/js/gd-ui/popover/index.js"></script>
</#if>
<script type="module">
	import { collectAction } from "/static/js/common.js"
    import { Select } from '/static/js/gd-ui/select/index.es.js'
    import CommonSearch from '/static/component/search/commonSearch.js'

    const commonSearch = new CommonSearch()
    commonSearch.setSearchFunc(searchUser)
	commonSearch.setReqFilterOptionsFunc(filterOptions)
    commonSearch.initRender()

    commonSearch.initInputEvent()
    if(!gugeeGobal.isMobile) {
        document.querySelectorAll('.filter-wrap .item-wrap').forEach(item => {
            item.style.display = 'grid'
        })
        document.querySelectorAll('.filter-wrap .filter-item > .label').forEach(item => {
            item.style.flex = '0 0 130px'
            item.style.lineHeight = '32px'
        })
        document.querySelector('.inline-item > .label').hide()
        document.querySelectorAll('.item-wrap .inline-item').forEach( item => {
            item.style.display = 'initial'
        })
    }

    function filterOptions(res) {
        if (res[0].Code === 200) {
            let wrapStr = ''

            const primaryCategory = filterWrap.querySelector('[data-param-key="primaryCategory"]')
            wrapStr += '<li class="gd-option is-active" role="option" aria-selected="true">All</li>'
            res[0].Data.forEach(item => {
                wrapStr += '<li class="gd-option" value="' + item.overallCategory +
                    '" role="option" aria-selected="false">' + item.overallCategory + '</li>'
            })
            primaryCategory.innerHTML = wrapStr

            const select = new Select()
            select.setElement([primaryCategory.parentElement.parentElement])
            select.setSelectedEvent(e => {
                const primaryValue = e.target.getAttribute('value')
                params.primaryCategory = primaryValue
                params.page = 1

                let url = getEncodeUrl('/ins/dic/category', {
                    overallCategory: primaryValue
                })
                const secondCategory = filterWrap.querySelector('[data-param-key="secondCategory"]')
                secondCategory.innerHTML = ''
                secondCategory.parentElement.previousElementSibling.querySelector('.label').innerText = 'Secondary'
                commonSearch.filterSelectedWrapEvent(e, {
                    label: 'Secondary',
                    paramKey: 'secondCategory',
                    value: ''
                })

                commonSearch.filterSelectedWrapEvent(e, {
                    label: e.target.parentElement.getAttribute('data-label'),
                    paramKey: e.target.parentElement.getAttribute('data-param-key'),
                    value: primaryValue
                })
                commonSearch.searchFnc()

                _axios.get(url).then(secRes => {
                    if(secRes.Code === 200) {
                        const secSelect = secondCategory.parentElement.parentElement
                        secSelect.classList.remove('gd-init-select')
                        let secWrap = '<li class="gd-option is-active" role="option" aria-selected="true">All</li>'
                        secRes.Data.forEach(item => {
                            secWrap += '<li class="gd-option" value="' + item.category +
                                '" role="option" aria-selected="false">' + item.category + '</li>'
                        })
                        secondCategory.innerHTML = secWrap

                        const secGDSelect = new Select()
                        secGDSelect.setElement([secSelect])
                        secGDSelect.setSelectedEvent(secEvent => {
                            const secValue = secEvent.target.getAttribute('value')
                            params.secondCategory = secValue
                            params.page = 1

                            commonSearch.filterSelectedWrapEvent(secEvent, {
                                label: secEvent.target.parentElement.getAttribute('data-label'),
                                paramKey: secEvent.target.parentElement.getAttribute('data-param-key'),
                                value: secValue
                            })
                            commonSearch.searchFnc()
                        })
                        secGDSelect.init()
                    }
                })
            })
            select.init()
        }
        if (res[1].Code === 200) {
            const regionWrap = filterWrap.querySelector('[data-param-key="region"]')
            const locationWrap = filterWrap.querySelector('[data-param-key="audienceRegionMore"]')
            let wrapStr = '<li class="gd-option is-active" role="option" aria-selected="true">All</li>'
            res[1].Data.forEach(item => {
                wrapStr += '<li class="gd-option" value="' + item.code +
                    '" role="option" aria-selected="false">' + item.name + '</li>'
            })
            regionWrap.innerHTML = wrapStr
            locationWrap.innerHTML = wrapStr
        }
        if (res[2].Code === 200) {
            const languageWrap = filterWrap.querySelectorAll('[data-label="Language"]')
            let wrapStr = '<li class="gd-option is-active" role="option" aria-selected="true">All</li>'
            res[2].Data.forEach(item => {
                wrapStr += '<li class="gd-option" value="' + item.code +
                    '" role="option" aria-selected="false">' + item.name + '</li>'
            })
            languageWrap.forEach(item => {
                item.innerHTML = wrapStr
            })
        }
        const select = new Select()
        select.setSelectedEvent(e => {
            const parentEle = e.target.parentElement
            const paramKey = parentEle.getAttribute('data-param-key')
            const value = e.target.getAttribute('value')
            params[paramKey] = value || undefined
            params.page = 1

            commonSearch.filterSelectedWrapEvent(e, {
                label: parentEle.getAttribute('data-label'),
                paramKey,
                value: value ? e.target.innerHTML : ''
            })
            commonSearch.searchFnc()
        })
        select.init()
    }

    function searchUser() {
        let wrap, url
        if(gugeeGobal.isMobile) {
            wrap = document.querySelector('.gd-mobile-list__wrap')
            commonSearch.hideFilter()
        } else {
            wrap = document.querySelector('#searchTable tbody')
        }

        wrap.showLoading()
        const input = document.getElementById('insKeyword')
        params.username = (input && input.value)?input.value: undefined

        if(gugeeGobal.isLogin) {
            url = getEncodeUrl('/ins/blogger', params)
        } else  {
            url = getEncodeUrl('/ins/blogger/search', params)

        }
        // visitRecode(15)
        commonSearch.getList(wrap, url, list => {
            let str = ''
            if(gugeeGobal.isMobile) {
                list.forEach(item => {
                    str += '<a href="/instagram/influencer/' + item.username + '">' +
                        '<div class="user-item">' +
                        '<div class="user-info">' +
                        '<div class="avatar">' +
                        '<img class="head" src="' + getImage(item.picUrl, IMAGE_TYPE.BLOGGER, IMAGE_SIZE.SMALL) + '" alt="' + item.fullName + '">'
                    if(item.isVerified) {
                        str += '<img class="auth" width="16" height="16" src="/static/img/ins/Authentication.png" srcset="/static/img/ins/Authentication@2x.png 2x" alt="auth image">'
                    }
                    str += '</div>' +
                        '<div class="user-title">' +
                        '<div class="top">' +
                        '<div class="nickname">' + item.username +'</div>'
                    <#--<svg title="${item.nation}" class="icon icon-country" aria-hidden="true">
									   <use xlink:href="#icon_${item.nation}"></use>
								   </svg>-->
                    if(item.categoryName) {
                        str += '<div class="category">' + item.categoryName + '</div>'
                    } else if (item.overallCategoryName) {
						str += '<div class="category">' + item.overallCategoryName + '</div>'
					}
                    str += '</div>' +
                        '<div class="bottom">Followers  ' + numFormat(+item.followerCount) + '</div>' +
                        '</div>'
                    str += '<div class="gd-popover">'
                    if(item.collectId) {
                        str += '<div class="icon-collect is-collect" data-fid="' + item.collectId + '">' +
                            '<i class="iconfont iconquxiaoshoucang33"></i>' +
                            '</div>'
                    } else {
                        str += '<div class="icon-collect" data-id="' + item.uid + '">' +
                            '<i class="iconfont iconxingxing"></i>' +
                            '</div>'
                    }
                    str += '</div>' +
                        '</div>' +
                        '<div class="user-data">' +
                        '<div class="data-item">' +
                        '<div class="label">Ad Post</div>' +
                        '<div class="num">' + numFormat(+item.adCount) + '</div>' +
                        '</div>' +
                        '<div class="data-item">' +
                        '<div class="label">Avg Ad ER</div>' +
                        '<div class="num">'+ numFormat(+item.brandMediaEr * 100) + '%</div>' +
                        '</div>' +
                        '<div class="data-item">' +
                        '<div class="label">Ad Engagements</div>' +
                        '<div class="num">' + numFormat(+item.adTec) + '</div>' +
                        '</div>' +
                        '</div>' +
                        '</div>' +
                        '</a>'
                })
            } else {
                list.forEach(item => {
                    str += '<tr>' +
                        '<td class="tb-user">' +
                        '<div class="avatar">' +
                        '<img src="' + getImage(item.picUrl, IMAGE_TYPE.BLOGGER, IMAGE_SIZE.SMALL) + '" alt="' + item.fullName + '">'
                    if(item.isVerified) {
                        str += '<img class="avatar__affix" src="/static/img/ins/Authentication.png" alt="authenticated"/>'
                    }
                    str += '</div>' +
                        '<div class="label">' +
                        '<div class="title">' + item.username
                    if(item.categoryName) {
						str += '<div class="category">' + item.categoryName + '</div>'
					} else if (item.overallCategoryName) {
						str += '<div class="category">' + item.overallCategoryName + '</div>'
					}
                    str += '</div>' +
                        '<div class="sub-title">Followers  ' + numFormat(+item.followerCount) + '</div>' +
                        '</div>' +
                        '</td>' +
                        '<td>' + numFormat(+item.adCount) + '</td>' +
                        '<td>' + numFormat(+item.brandMediaEr*100) + '%</td>' +
                        '<td>' + numFormat(+item.adTec) + '</td>'

                    /*'<td class="td-audience">'
					<#if login == true && user.roleId gt 1>
                        str += '<div class="tb-audience">'
                        if(item.nationDistribution && item.nationDistribution.length > 0) {
                            str += '<div class="audience-item">' +
                                item.nationDistribution[0].property + '  ' + numFormat(+item.nationDistribution[0].value * 100) +
                                '%</div>'
                        }
                        if(item.genderDistribution && item.genderDistribution.length > 0) {
                            str+= '<div class="audience-item">'
                            if(item.genderDistribution[0].property === 'MALE') {
                                str += '<i class="iconfont iconmale"></i>'
                            } else {
                                str += '<i class="iconfont iconfemale"></i>'
                            }
                            str += numFormat(+item.genderDistribution[0].value * 100) + '%</div>'
                        }
                        if(item.ageDistribution && item.ageDistribution.length > 0) {
                            str+= '<div class="audience-item">' +
                                '<span>' + item.ageDistribution[0].property + '</span>' +
                                numFormat(+item.ageDistribution[0].value * 100) + '%</div>'
                        }
                        str += '</div>'
                        <#else>
                        str += '<img class="tb-audience-img" src="${request.contextPath}/static/img/ins/Audience.png" alt="">'
                        </#if>
						str += '</td>'*/

                    str += '<td>' +
                        '<div class="td-action">' +
                        '<div class="blue">' +
                        '<div class="gd-popover" content="Analyze">' +
                        '<a href="/instagram/influencer/' + item.username + '" target="_blank">' +
                        '<i class="iconfont iconxiangqing""></i>' +
                        '</a>' +
                        '</div>' +
                        '</div>'
                    if(item.collectId) {
                        str += '<div class="gd-popover" content="Remove from Favorite">' +
                            '<div class="icon-collect is-collect" data-id="' + item.uid + '" data-fid="' + item.collectId + '">' +
                            '<i class="iconfont iconquxiaoshoucang33"></i>' +
                            '</div>' +
                            '</div>'
                    } else {
                        str += '<div class="gd-popover" content="Add to Favorite">' +
                            '<div class="icon-collect" data-id="' + item.uid + '">' +
                            '<i class="iconfont iconxingxing"></i>' +
                            '</div>' +
                            '</div>'
                    }
                    str += '</div>' +
                        '</td>' +
                        '</tr>'
                })
            }
            return str
        }, () => {
            const collectKey = 'uid', url = '/ins/fa/blogger'
            document.querySelectorAll('.icon-collect').forEach(element => {
                element.addEventListener('click', event => {
                    if(gugeeGobal.isMobile) {
                        collectAction({
                            element,
	                        url,
                            collectKey,
                            event,
                        })
                    } else {
                        collectAction({
                            element,
                            url,
                            collectKey,
                        })
                    }
                })
            })
        })
    }
</script>
</body>
</html>
